package Reader;

import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

public class StudentWriter{
    public static void main(String[] args) throws IOException, FileNotFoundException {
        BufferedReader reader=new BufferedReader(new FileReader("D:\\test\\student.txt"));
        String str=null;
        List<Student> list=new ArrayList();
        reader.readLine();
        while((str= reader.readLine())!=null){
            String[] s=str.split(" ");
            String id=s[0];
            String name=s[1];
            int age=Integer.parseInt(s[2]);
            Student student=new Student(id,name,age);
            list.add(student);
        }
        for (Student student:list) {
            System.out.println(student);
        }
        reader.close();
    }
}
class Student{
    private String id;
    private String name;
    private int age;

    public Student() {
    }

    public Student(String id, String name, int age) {
        this.id = id;
        this.name = name;
        this.age = age;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    @Override
    public String toString() {
        return "Student{" +
                "id='" + id + '\'' +
                ", name='" + name + '\'' +
                ", age=" + age +
                '}';
    }
}